/* 
 * File:   ContextConfig.h
 * Author: dell
 *
 * Created on 2012年4月2日, 上午11:33
 */

#ifndef CONTEXTCONFIG_H
#define	CONTEXTCONFIG_H

#include <string>
#include <vector>
#include "../common.h"

#include <evhttp/resources.h>
#include "ContentTypeConfig.h"

namespace Rapid{
    class ContextConfig {
    public:
        ContextConfig();
        virtual ~ContextConfig();

        std::string name;
        std::string docBase;
        unsigned int maxSpeed;

        std::vector<const char*> welcomeFiles;

        typedef hash_map<const char*, ContentTypeConfig*, hash<const char*>, HashMapStrIgnoreCaseCompare> ContentTypeConfigMap;
        ContentTypeConfigMap contentTypeConfigMap;

        void debug(){
            LOG_DEBUG("name:%s", name.c_str());
            LOG_DEBUG("docBase:%s", docBase.c_str());
            LOG_DEBUG("maxSpeed:%d", maxSpeed);

            std::vector<const char*>::iterator wfileit = welcomeFiles.begin();
            for(; wfileit != welcomeFiles.end(); wfileit++){
                LOG_DEBUG("welcome file is %s", *wfileit);
            }    

            ContentTypeConfigMap::iterator cttcit = contentTypeConfigMap.begin();
            for(; cttcit != contentTypeConfigMap.end(); cttcit++){
                ContentTypeConfig* contentTypeConfig = cttcit->second;
                contentTypeConfig->debug();
            }

        }

    private:

    };
}
#endif	/* CONTEXTCONFIG_H */

